﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Fly.FlyCommon;

using BllType = RN.ERP.BLL.BllType;

namespace RN.ERP.BLL
{
    public class BllFactory
    {
        public static IBll CreateBll(BllType bllType, DbType dbType)
        {
            switch (bllType)
            {
                case BllType.Basic:
                    {
                        switch (dbType)
                        {
                            case DbType.QD:
                                return new RN.ERP.BLL.QD.BasicBLL();
                            case DbType.Zbdlry:
                                return new RN.ERP.BLL.ZBDLRY.BasicBLL();
                            case DbType.WF:
                                return new RN.ERP.BLL.ZBDLRY.BasicBLL();
                            case DbType.LC:
                                return new RN.ERP.BLL.LC.BasicBLL();
                            case DbType.Unknow:
                            default:
                                return null;
                        }
                    }
                case BllType.Enterprise:
                    switch (dbType)
                    {
                        case DbType.QD:
                            return new RN.ERP.BLL.QD.EnterpriseBLL();
                        case DbType.Zbdlry:
                            return new RN.ERP.BLL.ZBDLRY.EnterpriseBLL();
                        case DbType.WF:
                            return new RN.ERP.BLL.WF.EnterpriseBLL();
                        case DbType.LC:
                            return new RN.ERP.BLL.LC.EnterpriseBLL();
                        case DbType.Unknow:
                        default:
                            return null;
                    }
                case BllType.Person:
                    switch (dbType)
                    {
                        case DbType.QD:
                            return new RN.ERP.BLL.QD.PersonBLL();
                        case DbType.Zbdlry:
                            return new RN.ERP.BLL.ZBDLRY.PersonBLL();
                        case DbType.WF:
                            return new RN.ERP.BLL.WF.PersonBLL();
                        case DbType.LC:
                            return new RN.ERP.BLL.LC.PersonBLL();
                        case DbType.Unknow:
                        default:
                            return null;
                    }
                case BllType.Authority:
                    switch (dbType)
                    {
                        case DbType.QD:
                            return new RN.ERP.BLL.QD.AuthorityBLL();
                        case DbType.Zbdlry:
                            return new RN.ERP.BLL.ZBDLRY.AuthorityBLL();
                        case DbType.WF:
                            return new RN.ERP.BLL.BaseAuthorityBLL();
                        case DbType.LC:
                            return new RN.ERP.BLL.LC.AuthorityBLL();
                        case DbType.Unknow:
                        default:
                            return null;
                    }
                case BllType.Order:
                    switch (dbType)
                    {
                        case DbType.QD:
                        case DbType.WF:
                        case DbType.Zbdlry:
                            return new RN.ERP.BLL.ZBDLRY.OrderBLL();
                        case DbType.LC:
                            return new RN.ERP.BLL.LC.OrderBLL();
                        case DbType.Unknow:
                        default:
                            return null;
                    }
                case BllType.Project:
                    switch (dbType)
                    {

                        case DbType.Zbdlry:
                            return new RN.ERP.BLL.ZBDLRY.ProjectBLL();
                        case DbType.LC:
                            return new RN.ERP.BLL.LC.ProjectBLL();
                        case DbType.Unknow:
                        default:
                            return null;
                    }


                case BllType.KaoHe:
                    switch (dbType)
                    {
                        case DbType.QD:
                            return new RN.ERP.BLL.QD.KaoHeBLL();
                        case DbType.Zbdlry:
                            return new RN.ERP.BLL.ZBDLRY.KaoHeBLL();
                        case DbType.LC:
                            return new RN.ERP.BLL.LC.KaoHeBLL();
                        case DbType.Unknow:
                        default:
                            return null;
                    }
                default:
                    return null;
            }

        }

        public static IBll CreateBll(BllType bllType, string areaCode)
        {
            switch (bllType)
            {
                case BllType.Basic:
                    switch (areaCode)
                    {
                        case "0299":
                            return new RN.ERP.BLL.QD.BasicBLL();
                        case "0298":
                            return new RN.ERP.BLL.QDJG.BasicBLL();
                        case "14":
                            return new RN.ERP.BLL.LC.BasicBLL();
                        default:
                            return new RN.ERP.BLL.ZBDLRY.BasicBLL();
                    }
                case BllType.Enterprise:
                    switch (areaCode)
                    {
                        case "0299":
                            return new RN.ERP.BLL.QD.EnterpriseBLL();
                        case "0298":
                            return new RN.ERP.BLL.QDJG.EnterpriseBLL();
                        case "0799":
                            return new RN.ERP.BLL.WF.EnterpriseBLL();
                        case "14":
                            return new RN.ERP.BLL.LC.EnterpriseBLL();
                        default:
                            return new RN.ERP.BLL.ZBDLRY.EnterpriseBLL();
                    }
                case BllType.Person:
                    switch (areaCode)
                    {
                        case "0299":
                            return new RN.ERP.BLL.QD.PersonBLL();
                        case "0298":
                            return new RN.ERP.BLL.QDJG.PersonBLL();
                        case "0799":
                            return new RN.ERP.BLL.WF.PersonBLL();
                        case "14":
                            return new RN.ERP.BLL.LC.PersonBLL();
                        default:
                            return new RN.ERP.BLL.ZBDLRY.PersonBLL();
                    }
                case BllType.Authority:
                    switch (areaCode)
                    {
                        case "0299":
                            return new RN.ERP.BLL.QD.AuthorityBLL();
                        case "14":
                            return new RN.ERP.BLL.LC.AuthorityBLL();
                        default:
                            return new RN.ERP.BLL.ZBDLRY.AuthorityBLL();
                    }
                case BllType.KaoHe:
                    switch (areaCode)
                    {
                        case "0299":
                            return new RN.ERP.BLL.QD.KaoHeBLL();
                        case "14":
                            return new RN.ERP.BLL.LC.KaoHeBLL();
                        default:
                            return new RN.ERP.BLL.ZBDLRY.KaoHeBLL();
                    }
                default:
                    return null;
            }

        }
    }
}
